package com.goddess.yeecolor.view;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.goddess.yeecolor.R;

/**
 *底部界面
 */
public class Item_ExerciseItemButtom {

    /**
     * 分享
     * @param view
     * @return
     */
    public static TextView initShare(View view, View.OnClickListener onClickListener){
        TextView textTitle=(TextView)view.findViewById(R.id.item_exercisebuttom_share);
        textTitle.setOnClickListener(onClickListener);
        return textTitle;
    }

    /**
     * 收藏
     * @param view
     * @param onClickListener
     * @return
     */
    public static TextView textCollect ;
    public static TextView initCollect(View view, View.OnClickListener onClickListener,int tag){
         textCollect=(TextView)view.findViewById(R.id.item_exercisebuttom_collect);
        if (tag==0){
            textCollect.setSelected(false);
        }
        else if (tag==1){
            textCollect.setSelected(true);
        }

//        textCollect.setOnClickListener(onClickListener);
        return textCollect;
    }

    /**
     * 购买  判断购买
     * @param view
     * @param onClickListener
     * @return
     */
    public  static TextView textBuy,textfinish;
    public static FrameLayout buyLinear;
    public static LinearLayout item_exercisebuttom;
    public static FrameLayout initBuy(View view,int buy,double picese){
        textBuy=(TextView)view.findViewById(R.id.item_exercisebuttom_buy);
        textfinish=(TextView)view.findViewById(R.id.item_exercisebuttom_baomingFinish);
        item_exercisebuttom= (LinearLayout) view.findViewById(R.id.item_exercisebuttom);
        buyLinear= (FrameLayout) view.findViewById(R.id.item_exercisebuttom_buyLinear);
        if (buy==1)
        {
//            buyLinear.setVisibility(View.INVISIBLE);
            textfinish.setText("我已报名");
            textfinish.setVisibility(View.VISIBLE);

        }
        else if (buy==0){
            textfinish.setVisibility(View.INVISIBLE);
            item_exercisebuttom.setVisibility(View.VISIBLE);
            textBuy.setText(picese+"");
        }
        else if (buy==2){
            textfinish.setText("活动已结束");
            textfinish.setVisibility(View.VISIBLE);
        }
        return buyLinear;
    }
}
